package com.kay;

import com.kay.pojo.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

/**
 * @Description:
 * @Author: Kay
 * @CreateDate: 2021/6/29$ 13:05$
 * @UpdateUser: Kay
 * @UpdateDate: 2021/6/29$ 13:05$
 */
public class PluginTest {
    @Test
    public void testSelect() throws IOException {
        InputStream resourceAsStream = Resources.getResourceAsStream("SqlMapConfig.xml");
        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = sessionFactory.openSession();
        System.out.println("-------- sqlSession已创建，准备执行 查询方法 ");
        User user = sqlSession.selectOne("com.kay.dao.UserMapper.findById",1);
    }
}
